package com.zr.action;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.dao.impl.ZLCSuserdaoimpl;
import com.zr.service.mainserver;
import com.zr.service.impl.mainserverimpl;

public class Cuser extends HttpServlet {
/*
 * @zl
 * 修改用户角色
 * */
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	
	@Override
		protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
			// TODO Auto-generated method stub
		  //获得用户UID，被改动角色rid
		  String rid= req.getParameter("rid");
		  //String uid = req.getParameter("uid");
		  String[] uids = req.getParameterValues("uids[]");
		  int rids = Integer.parseInt(rid);
		  //int uids =Integer.parseInt(uid);
		  //修改uid对应用户为rid的角色
		  //ZLCSuserdaoimpl cuser  = new ZLCSuserdaoimpl();
		  mainserver ms = new mainserverimpl();
		  for (String string : uids) {
			int uid =Integer.parseInt(string);
			ms.setuser(uid, rids);
		}
		  
		  //ms.setuser(uids, rids);
		}
}
